<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%-- 引入页面头 --%>
<%@ include file="/pageHead.jsp"%>
<form name="form1" id="form1"
	action="<%-- ${systemctx}/sample/saveSample.web --%>" method="post">
	<div class="pageMain">
		<div class="pageTitle">
			<%=MessageResourcesUtils.getMessage(request,"systemmanage.report")%>
			<span></span>
			派单数据
			<span></span>
			派单列表
		</div>
		<div class="pageBody">
			<div class="pageBody">
			<div class="form-group">
				<ul>
					<li>
						<i></i> <label>操作开始时间</label>
						<span><input type="text" value="${startTime}" name="startTime" id="startTime" class="validate[required]"></span>
					</li>
					<li>
						<i></i> <label>操作结束时间</label>
						<span><input type="text" value="${endTime}" name="endTime" id="endTime" class="validate[required]"></span>
					</li>
				</ul>
				<ul>
					<li>
						<i></i>
						<label>
							译员ID
						</label>
						<span><input type="text" id="translatorid" name="translatorid"/></span> 
					</li>
					<li>
						<i></i>
						<label>
							译员真名
						</label>
						<span><input type="text" id="translatorName" name="translatorName"/></span> 
					</li>
				</ul>
				<ul>
					<li>
						<i></i>
						<label>
							服务ID
						</label>
						<span><input type="text" id="flow_id" name="flow_id"/></span> 
					</li>
				</ul>
			</div>
		</div>
		</div>
		<div class="button-group">
			<input type="button" class="btn btn-default" id="butQuery" name="butQuery" value="<%=MessageResourcesUtils.getMessage(request,"common.button.query")%>" />
			<input type="button" class="btn btn-default" onclick="exportCall()" value="<%=MessageResourcesUtils.getMessage(request,"common.button.export")%>" /> 
		</div>
		<table width="100%">
			<tbody>
				<tr>
					<td>
						<table id="datagrid"></table>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</form>


<script type="text/javascript">
$(document).ready(function() {
	$("#startTime").date_input();
	$("#endTime").date_input();
	//加载分页控件 datagrid
	$('#datagrid').issdatagrid(
	{
		formid : 'form1',
		title : '派单数据列表',
		width : 'auto',
		nowrap : true,
		autoRowHeight : false,
		singleSelect : true,
		striped : true,
		//collapsible:true,
		url : '${systemctx}/systemmanage/exportreport/queryTranslatorOrderDataGrid.json',
		sortName : '',
		sortOrder : '',
		remoteSort : true,
		pagination : true,
		rownumbers : true,
		showFooter : true,
		queryParams:$('#form1').serializeObject(),
		columns : [ 
		[
		{
			title : '服务ID',
			field : 'flow_id',
			width : 250,
			sortable : true,
			align : 'left'
		},{
			title : '译员ID',
			field : 'translatorid',
			width : 200,
			sortable : true,
			align : 'left'
		}, {
			title : '译员真名',
			field : 'truename',
			width : 200,
			sortable : true,
			align : 'left'
		}, {
			title : '操作结果',
			field : 'processresult',
			width : 150,
			sortable : true,
			align : 'left'
		}, {
			title : '操作时间',
			field : 'optime',
			width : 200,
			sortable : true,
			align : 'left'
		}] ],
		onLoadSuccess : function(data) {

		}
	});
	

	$('#butQuery').click(function() {
		
		$('#datagrid').datagrid('load',$('#form1').serializeObject());
	});


});

function downloadfile(datestr,file){

    $.ajax({
    	url: "${systemctx}/systemmanage/exportreport/mp4exists.web?date=" + datestr + "&fname=" + file,
    	type:'post',
    	dataType:'json',
    	 success: function(data){
    	        if(data.msg==1){
    	        	window.location.href = "${systemctx}/systemmanage/exportreport/download.web?date=" + datestr + "&fname=" + file; 
    	        }else{
    	        	var $win;
    	        	$("#dfilename").html(file+"文件不存在")
    	        	$win = $('#dwwin').window({
    	                title:'下载',
    	                width: 550,
    	                height: 230,
    	                top:($(window).height() - 230) * 0.5,   
    	                left:($(window).width() - 550) * 0.5,
    	                shadow: true,
    	                modal:true,
    	                iconCls:'icon-add',
    	          		closed:true,
    	          		minimizable:false,
    	          		maximizable:false,
    	          		collapsible:false
    	             });
    	        	$win.window('open');
    	        }
    	 }
    })
}


function exportCall() {
	if (confirm("是否导出派单数据？")) {
		

		var startTime = $("#startTime").val();
		var endTime = $("#endTime").val();
		
		var flow_id = $("#flow_id").val();
		var translatorid = $("#translatorid").val();
		var translatorName = $("#translatorName").val();
		if(null == startTime || startTime == '' || startTime == 'undefined'){
			alert("开始时间不能为空");
			return;
		}
		
		if(null == endTime || endTime == '' || endTime == 'undefined'){
			alert("结束时间不能为空");
			return;
		}
		
		var startDate = new Date(startTime);
		var endDate = new Date(endTime);
	
		if(startDate > endDate){
			alert("开始时间不能小于结束时间");
			return;
		}

		window.location.href = "${systemctx}/systemmanage/exportreport/exportTranslatorOrderReport.web?startTime=" + startTime + "&endTime=" + endTime+ 
				"&flow_id=" + flow_id+ "&translatorid=" + translatorid+ "&translatorName=" + translatorName; 
	}
}
	
	
	
	
	
</script>
<%-- 引入页面尾 --%>
<%@ include file="/pageFloor.jsp"%>